#!/bin/sh

set -ev
rm -rf src
mkdir -p src; cd src
mkdir -p p/pa;
mkdir -p p/pb;

go mod init myproject || true
cat >main.go <<EOF
package main
import "log"
import "myproject/p/pa"
import "myproject/p/pb"
func main() {
    log.Println("start");
    pp7.Pp()
    pp8.Pp()
}
EOF

cat >p/pa/p7.go <<EOF
package pp7
import "log"
func Pp() {
    log.Println("in p7");
}
EOF

cat >p/pb/p8.go <<EOF
package pp8
import "log"
func Pp() {
    log.Println("in p8");
}
EOF

go build -o test main.go
./test
